<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
		<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
		<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
		<title>上传中心</title>
		<script type="text/javascript">
			$(document).ready(function() {
				$.ajax({
					type: "get",
					url: "cansubmit.do",
					async: false,
					dataType: "json",
					success: function(data) {
						var strings = "";
						for(var i = 0; i < data.list.length; i++) {
							strings += "<option value=\"" + data.list[i].idtype + "\">" + data.list[i].name + "</option>"
						}
						$("#type")[0].innerHTML=strings;
						$("#type2")[0].innerHTML=strings;
					}
				});
			})

			function submit() {
				var a = new Array;
				if($("#group1").val() != "" && $("#group2").val() != "") {
					a[0] = $("#group1").val();
					a[1] = $("#group2").val();
				} else if($("#group1").val() != "") {
					a[0] = $("#group1").val();
				} else if($("#group2").val() != "") {
					a[0] = $("#group2").val();
				}
				$("#list").val(JSON.stringify(a));
				document.getElementById("file").submit();
			}
		</script>
	</head>

	<body>
		<div class="jumbotron">
			<div class="container">
				为了保证服务器安全，禁止上传如JSP,PHP等可添加后端控制页面。依据国家相关法律条例，禁止网页中存在 色情，反动等国家相关条例禁止的图片或文字，如果出现此类问题，上传者需承担一切法律责任<br> 如果上传后想要修改项目，请联系管理员（各班助教 或 16002班高梓峻），建议bootstrap等工具使用cdn加速链接连入项目，以降低文件资源占用
			</div>
		</div>
		<div class="container" style="padding-top: 100px;">
			<div class="row">
				<div class="col-md-8">
					<input type="text" id="upload-text" class="form-control" readonly="readonly" />
				</div>
				<div class="col-md-4">
					<button class="btn btn-default" onclick="document.getElementById('upload').click()">选择文件</button>

					<button type="submit" onclick="submit()" class="btn btn-info">提交</button>
				</div>
				<div class="col-md-8">
					同组成员：<br />
					<input type="number" id="group1" class="form-control" />
					<input type="number" id="group2" class="form-control" />
					<select name="type" id="type" onchange="$('#type2').val(this.value)"></select>
				</div>
				<form id="file" method="post" action="upload.do" enctype="multipart/form-data" class="col-md-offset-1 row">
					<select name="type" id="type2" style="display:none;"></select>
					<input type="file" name="file" id="upload" onchange="$('#upload-text').val(this.value)" style="display:none;" />
					<input type="text" name="list" id="list" style="display:none;" />
				</form>
			</div>

		</div>
	</body>

</html>